﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NNUser : MonoBehaviour {
    public UISprite avatarSprit;
    public UILabel UserNameLabel;
    public UILabel GoldLabel;
    public UITexture wxAvatar;
    public GameObject WaitLabel;
    public int SeatID;

    //抢庄倍数
    public GameObject NoQiang;
    public GameObject Qiang;
    public UISprite MultipleSprit;

    //庄家状态
    public GameObject Banker;
    public GameObject BankerStatus;

    //闲家倍数
    public UISprite PlayerMultipleSprit;

    //聊天
    public GameObject textObj;
    public UILabel text;
    public UISprite face;
    private void Awake()
    {
        UIEventListener.Get(avatarSprit.gameObject).onClick = ButtonClick;
    }
    void ButtonClick(GameObject button)
    {
        if (button.name == "Avatar")
        {
            GameObject userInfo = NGUITools.AddChild(GameObject.Find("UI Root"), (GameObject)(Resources.Load(GameDNPrafabPath.NNUserInfo)));
            userInfo.GetComponent<NNUserInfo>().LoadUserInfo(SeatID); 
        }
    }

    /// <summary>
    /// 加载抢庄倍数
    /// </summary>
    /// <param name="MultipleNum"></param>
    public void BankerMultipleSet(int MultipleNum) {
        Debug.Log("MultipleNum:"+ MultipleNum);
        if (MultipleNum == 0)
        {
            
            NoQiang.SetActive(true);
        }
        else {
            Qiang.SetActive(true);
            MultipleSprit.spriteName = MultipleNum.ToString();
        }
    }
    /// <summary>
    /// 隐藏抢庄倍数
    /// </summary>
    public void HideBankerMultiple() {
        NoQiang.SetActive(false);
        Qiang.SetActive(false);
    }

    /// <summary>
    /// 加载闲家倍数
    /// </summary>
    /// <param name="MultipleNum"></param>
    public void PlayMultipleSet(int MultipleNum) {
        HideBankerMultiple();
        PlayerMultipleSprit.gameObject.SetActive(true);
        PlayerMultipleSprit.spriteName = MultipleNum.ToString()+"bei" ;
    }
    /// <summary>
    /// 隐藏闲家倍数
    /// </summary>
    public void HidePlayerMultiple() {
        PlayerMultipleSprit.gameObject.SetActive(false);
    }

    public void Init() {
        NoQiang.SetActive(false);
        Qiang.SetActive(false);
        Banker.SetActive(false);
        BankerStatus.SetActive(false);
        PlayerMultipleSprit.gameObject.SetActive(false);
    }
}
